<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1></h1>
    <h2></h2>
    <h3></h3>
    <script>
        //模拟获取数据
        class getData {
            constructor(id){
                this.id = id;
            }
            get(){
                return ["王",22,"男"];
            }
        }
        //对页面进行渲染
        class Obj {
            constructor(name,age,sex,...other){
                this.name = name;
                this.age = age;
                this.sex = sex;
            }
            getName(){
                document.getElementsByTagName("h1")[0].innerText = this.name;
                return this;
            }
            getAge(){
                document.getElementsByTagName("h2")[0].innerText = this.age;
                return this;
            }
            getSex(){
                document.getElementsByTagName("h3")[0].innerText = this.sex;
                return this;
            }
        }
        let data = new getData(16);
        let dataList = data.get();
        let thing = new Obj(...dataList);
        thing.getName().getAge().getSex();
    </script>
</body>
</html>